﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using MeizuSDK.Presentation;
using System.Drawing;

namespace Demo
{
    class DemoWindowBase : Form
    {
        protected ToolBar toolbar = new ToolBar();

        public DemoWindowBase()
        {
            this.AnimationIn = MeizuSDK.Drawing.AnimationType.ScrollRightToLeftPush;
            this.AnimationOut = MeizuSDK.Drawing.AnimationType.ZoomOut;
        }

        protected override void OnLoad(EventArgs e)
        {
            toolbar.SetTextButton(ToolBarButtonIndex.LeftTextButton, true, true, "返回");
            toolbar.ButtonClick += new EventHandler<ToolBar.ButtonEventArgs>(toolbar_ButtonClick);
            Controls.Add(toolbar);

            base.OnLoad(e);
        }

        protected virtual void toolbar_ButtonClick(object sender, ToolBar.ButtonEventArgs e)
        {
            if (e.Index == ToolBarButtonIndex.LeftTextButton)
            {
                if(IsDialog)
                    DialogResult = DialogResult.Yes;
                else
                    Close();
            }
        }
    }
}
